package com.itheima.date;

import java.util.Date;

public class Demo02 {

    public static void main(String[] args) {
        //获取 时间对象 到计算机原点的 时间毫秒值
        Date date = new Date();
        long time = date.getTime();
        long l = System.currentTimeMillis();
        System.out.println(time);
        System.out.println(l);
        System.out.println(time==l);


        //设置这个毫秒值
        date.setTime(1000*60*60*24);
        System.out.println(date);
        Date date1 = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24);
        System.out.println(date1);


        System.out.println(date.getYear());
        System.out.println(date.getMonth());
        System.out.println(date.getDate());
        System.out.println(date.getHours());
        System.out.println(date.getMinutes());
        System.out.println(date.getSeconds());
        date.setYear(-10);
        System.out.println(date);
        date.setMonth(7);
        System.out.println(date);

    }
}
